package com.team.kgc.grade.util;

import com.team.kgc.grade.entity.Student;
import com.team.kgc.grade.mapper.StudentMapper;
import com.team.kgc.grade.service.StudentService;
import com.team.kgc.grade.service.impl.StudentServiceImpl;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import java.util.List;

public class Test {
//    public static void main(String[] args) {
//        //调用dao层
//        ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationContext.xml");
////        StudentMapper studentMapper=(StudentMapper)ctx.getBean("studentMapper");
////        System.out.println(studentMapper.selectByExample(null).size());
//        StudentService studentService=(StudentService)ctx.getBean("studentSerivce");
//       List<Student>li= studentService.getAllStudent();
//       li.forEach(student -> {
//           System.out.println("学号:"+student.getXh()+"--->姓名:"+student.getName()+"--->年龄:"+student.getAge()+"--->性别:"+student.getSex());
//       });
//
//    }

    public static void main(String[] args) {
        ApplicationContext ctx=new ClassPathXmlApplicationContext("applicationContext.xml");
        StudentService studentService=(StudentService)ctx.getBean("studentService");
            studentService.deleteStudentByGid(102);

    }

}
